Method and device for storing and matching arbitrary wide expressions to content addressable memories

ABSTRACT

The present invention relates to a method for storing arbitrarily wide expressions ( 31 ) in a set of Content Addressable Memory (CAMs) elements ( 33 ) where each CAM element is of lesser width than the expression ( 31 ). The CAM element may be a physical CAM or part of a physical CAM. The invention also relates to a method for searching wide expressions in such sets of CAM elements ( 33 ). The invention further relates to a device and a computer program for performing the method.

TECHNICAL FIELD

[0001] The present invention relates to a method for storing wideexpressions in a Content Addressable Memory (CAM) comprising a set ofCAM elements of less width and matching of wide expressions to thecontents of the set of CAM elements.

[0002]

BACKGROUND OF THE INVENTION

[0003] A Content Addressable Memory (CAM) is a memory device that hasbecome increasingly valuable during the recent years in someapplications. A CAM can perform fast storing and search operations. TheCAM provides a performance advantage over memory search algorithms suchas binary and tree based searches or look-aside tag buffers by comparingthe desired information against the entire list of pre-stored datasimultaneously often resulting in an order-of-magnitude reduction ofsearch time. Once information is stored in a CAM location, it is foundby comparing every bit in the CAM with the bits of the data in a searchexpression. If there's a match for every bit in a location with everycorresponding bit in the search expression, an output is obtained fromthe CAM, which is an association value or address pointing to associatedinformation. The associated information may be stored in a conventionalmemory device such as a RAM. Depending on the application, the RAM cancontain information or instructions or operations or the like to bedisplayed or performed when there is a match between the searchexpression and the information stored in the CAM. Thus, with a CAM, thedata is supplied and the address is obtained.

[0004] Because the CAM doesn't need address lines to find data, thedepth of a memory system using CAMs can be extended as far as desired,but the width is limited by the size of the chip. For example, a CAMchip can be 64 to 128 bits wide, but 32768 entries deep. It is fairlyeasy to extend the depth of the CAM, because the addressing is allself-contained.

[0005] Some CAMs are so called ternary CAMs in which the stored data cancontain bit values of 0, 1 or X, where X is “don't care” i e the valuematches both 0 and 1.

[0006] The function and advantages of the CAM memory makes it verysuitable for applications and operations such as LANs, data basemanagement, file-storage management, look-up to pattern recognition, andthe like, and is particularly suited to performing search operations.For example, the CAM's may be utilised in connection with InternetProtocol (IP) classification, which is done in routers. This is theprocess of classifying IP packets into categories that require specialtreatment. A subset of IP classification is IP filtering. IP filteringis a security feature that restricts IP traffic by permitting or denyingpackets by applying certain rules. This way, users can be restricted tospecific domains or applications on the Internet. To performclassification, IP headers of packets that reach a router need to becompared to patterns stored in a table, generating an output thatclassifies the packet. Usually, this table is stored in memory andmatching is done in software.

[0007] Due to increasing performance requirements and larger and widersearch sets, software-based search algorithms become too slow andalternative implementations need to be considered. One such alternativeis to use a CAM. Commercially available CAMs are however not wide enoughfor IP version 6 (IPv6) classification. At the present the widest CAMsavailable are 136 bits wide, which is enough to contain a 128-bits wideIPv6 address. However, when classifying packets in a router, it isnecessary to look at a number of fields in the header such as thedestination address, which is 128 bits wide, and the source address,which is also 128 bits wide. Further information may also be required tobe looked at, which in total may require several hundred bits. It isthus not possible to use the commercially available CAMs in an IPv6router in a conventional manner.

BRIEF DESCRIPTION OF THE INVENTION

[0008] The object of the invention is to provide a method in which CAMsof less width are used to store expressions in CAMs and to matchexpressions with the contents of CAMs, where the width of the expressionis larger than the width of the CAMs used, i. e. emulating a wide CAMwith a set of smaller CAMs. The term “expression” in this context is tobe understood as comprising a row of an arbitrary number of bits whereeach bit may be 0, 1 and possibly X if ternary CAMs are used, where theexpression forms or contains information or data such as words,addresses, port numbers and the like.

[0009] To emulate a wide CAM using a structure of associated less wideCAMs, the wide expression is divided into smaller parts, hereafter namedCAM words, where each CAM word is assigned to a CAM element and storedin the CAM element. A CAM element can in this context be a physical CAMor a dedicated part of a CAM. In any event, the CAM element is of alesser width than the wide expression.

[0010] Each CAM word that is stored in the respective CAM element isassigned an association value as output, which value is combined withanother CAM word assigned to another CAM element. Such associationsbetween the CAM words of the CAM elements can be made using a serial ora parallel scheme or any combination of these.

[0011] In a serial scheme each CAM word is associated to the subsequentCAM word of the stored expression, thus forming a serial connectionbetween the CAM words. In a parallel scheme each CAM word is associatedto the last of the CAM words of the stored expression, thus forming aparallel connection between the CAM words.

[0012] One CAM word assigned to a CAM element is assigned the outputvalue of the complete expression. This CAM element is referred to aslast CAM element. The CAM word of this last CAM element must beassociated, directly or indirectly, to all other CAM words of the otherCAM elements such that it verifies that all CAM words together form thecomplete expression.

[0013] When performing matching, the expression to be matched, hereafternamed the search expression, is divided into smaller parts, searchwords, where each search word is compared with the contents of thecorresponding CAM element, the CAM words, in a sequential order throughthe CAM element. When a match is obtained between a CAM word of the CAMelement and the specific search word, i e a part of the searchedexpression, the output value of the CAM word is combined with the inputof its associated CAM element following the same scheme as above.

[0014] The output of the last CAM element will be the resulting outputof the total emulated CAM. The output value may be used directly such asfor example denying or permitting a packet access to LAN resources whena match is found, or the value may be used in combination with forexample a RAM memory, containing information and/or data, such asrouting a packet to a specific port in a router when a match is found,where the information regarding the port is stored in a memory location,associated with the stored and matched CAM word.

[0015] As a CAM can only return one value, multiple matches are notdetected, which could be the case with ternary CAMs where some bits maybe X, i e either 0 or 1, and only the output of the CAM word withhighest priority is returned. In most CAMs the priority is sequentialand falling, i e the CAM words at the top of the CAM have higherpriority, mainly because of the sequential way of searching. However,there might be other priority orders such as rising or that each storedCAM word receives an individual priority regardless of its position inthe CAM. However, the CAM word with highest priority might not be partof the complete matching expression, but a CAM word with lower priorityis. To resolve this, additional CAM words, called “shares”, are added tothe CAM.

[0016] Shares are the result of an operation on a number of stored CAMwords. If two CAM words intersect, i e there exist search words forwhich both these CAM words match, a share has to be created. Thecreation of the share is such that for those bits of the compared CAMwords that are equal, the corresponding bits of the share receive thatvalue, and for those bits that are X in one of the CAM words and defined(0 or 1) in the other CAM word, the corresponding bits of the sharereceive the defined value. In that way the share will match all searchwords for which all its arguments match. It is further necessary toprioritise the share over the CAM words from which it was created, i estore the share above them, in order for it to cover or shadow them, sothat in a search, the search word reaches the share first.

[0017] According to the invention, the CAM elements may be divided intolevels with different priority, such that shares created due to twointersecting CAM words are placed on a higher level than theintersecting words, thereby ensuring and facilitating the prioritisationof the shares in relation to the CAM words.

[0018] Using shares it is possible to detect multiple matches using oneoutput value. In this way all complete expressions that possibly matchare explored.

[0019] To cover all possible cases of multiple matches in a CAM element,all possible shares must be added, based on any combination and numberof CAM words that can match simultaneously. Furthermore, each share mustbe added, such that it is prioritised over the original CAM words andalso over other shares that have fewer arguments.

[0020] Finally, CAM words can be omitted if the union of all CAM wordsthat have a higher priority shadows them. With the method according tothe invention, wide expressions can be stored in a set of smaller CAMs.This enables efficient searches for expressions with arbitrary widthusing commercially available circuits. An alternative to the methodaccording to the invention is a memory-based algorithm, such as a binaryor tree-based search. CAMs supply the performance advantage over thiskind of algorithms, by comparing the expression that we want to matchagainst the entire list of pre-stored CAM words simultaneously, givingorders-of-magnitude reduction in the search time. Using CAMs, searchesare done in constant time and the search time merely depends on therequired number of CAM calls and therefore the width of the expressions.

[0021] These and other advantages and aspects of the invention willbecome apparent from the following detailed description and from theaccompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In the following detailed description of the invention, referencewill be made to the accompanying drawings, of which

[0023]FIG. 1 shows a schematic representation of storing wide searchexpressions in smaller CAM elements using a serial scheme according tothe invention,

[0024]FIG. 2 shows a schematic representation of storing wide searchexpressions in three smaller CAM elements using a parallel schemeaccording to the invention,

[0025]FIG. 3 a-e show connection between CAM words in different CAMelements,

[0026]FIG. 4 shows CAM words A and B represented as numeric ranges,

[0027]FIG. 5 shows CAM words A, B and A∩B represented as numeric ranges,

[0028]FIG. 6 shows CAM words A, B and C represented as numeric ranges,

[0029]FIG. 7 shows CAM words A, B and C represented as numeric rangesand the use of shares according to the invention, and

[0030]FIG. 8 shows schematically a computing device according to theinvention.

DETAILED DESCRIPTION OF THE INVENTION

[0031] The present invention relates to storing and searching in CAMsand in particular ternary CAMs. Searches in a CAM are done by comparinga search expression, which is supplied as input to the CAM, withpatterns (CAM words) that are stored in the CAM. If a CAM word matchesthe search expression, a match is indicated and an output value isreturned. The output value may be an address that can be used to accessa memory, for example a RAM memory, where the corresponding output valuefor this match is specified. In this document the term CAM refers tothis combination.

[0032] In a ternary CAM, CAM words can contain bit-values of 0, 1 and X,where X matches both 0 and 1 in the search word.

[0033] Assume that the expressions or entries that are used and are tobe stored are wider than the width of the CAM used. According to theinvention the expression 31 is divided into parts, here named CAM words32. Each part is stored in a location of a CAM element 33, wherein eachCAM element 33 is less wide than the total width of the expression 31.Each CAM element 33 can either be a physical CAM or a dedicated part ofa CAM and can be of different size in terms of bit width and number ofstorage locations (depth of the CAM). If the CAM elements are arrangedin one physical CAM, parts of the bits of the CAM can be used toindicate that a certain number of locations belong to a certain CAMelement. Each CAM word 32 of the expression is stored in a word field 34of a specific CAM element and each CAM word is connected to other CAMwords by using an association value 35 (symbolically indicated by meansof an arrow in FIG. 1 and FIG. 2), where the association value 35 is theoutput value from one CAM word and where the association value isarranged in an appendix, hereafter named selection field 36, connectedto the word field 34 of the associated CAM word in another CAM element33. At least one of the CAM elements 33 has a selection field 36.

[0034] One approach according to the invention is to combine these CAMelements 33 serially. The serial scheme may be described as follows:test the number of bits that fits in the first CAM element and storethis part of the expression 31, the CAM word 32, in the word field 34 ofthe CAM element 33. A subsequent number of bits of the expression aretested against the next CAM element and this CAM word is stored in thenext CAM element. The association value 35 of the first CAM word isentered into the selection field 36 of the subsequent CAM word. Theprocess is repeated until the whole expression is stored in CAM elements33, where each CAM word is associated with the subsequent CAM word bythe association values 35, FIG. 1.

[0035]FIG. 1 can, apart from illustrate storing of wide expressions 31,be used to illustrate matching of a search expression with expressionsstored in CAMs. In the following description of matching the referencenumeral 31 refer to a search expression and the reference numeral 32 toa search word.

[0036] When matching is to be performed, the search expression 31 isdivided into a number of parts, search words 32, where each search word32 has a bit width corresponding to its CAM element 33. The first searchword 32 is compared to the CAM words in the word fields 34 of the firstCAM element. When a match is obtained, the output value from the matchedCAM word, the association value 35, is combined with the next searchword. The next search word, together with the association value 35obtained from the first match, is tested against the CAM words in thesecond CAM element. When a match is obtained between the search word 32and a CAM word and the association value 35 combined to the search wordmatches the contents of the selection field 36, an output value isobtained, association value 35, which in turn is combined with the nextpart of the expression. The process continues until a match is obtainedbetween all search words and the CAM words of the CAM elements.

[0037] When a complete match is obtained of the specific CAM word, anassociation value for the complete expression is returned. Theassociation value may be used as an address to a conventional RAMmemory.

[0038] The number of CAM elements 33 that is needed to match the widesearch word 31 is such that the total width of all word fields 34 islarger or equal to the width of the search word that is to be matched.

[0039] Another approach according to the invention is to use a parallelscheme. With the parallel scheme the width of the expression 31 ischecked in order to establish the number of CAM elements 33 required forstoring, based on knowledge of the width of each CAM element available.The first part of the expression, the first CAM word 32, is stored in aword field 34 in a first CAM element. The association value 35 of theCAM word is entered into a selection field 36 of the last CAM elementrequired for storing the particular expression 31. The next part of theexpression is stored in the word field of another CAM element and itsassociation value 35 is entered in a further selection field 36 in thelast CAM element. The process continues until all parts of theexpression are stored in CAM elements 33. The last CAM element has thusa number of selection fields 36 corresponding to the number of CAMelements used for storing the expression except for the last part of theexpression (if there is any). This scheme is illustrated in FIG. 2 forthree CAM elements.

[0040] When a matching is to be performed with the parallel scheme, thefirst part of the search expression 31, search word 32, is compared tothe contents of the word fields 34 of the first CAM element 33. When amatch is obtained between the search word 32 and a CAM word, theassociation value 35 of the CAM word is entered as input in the last CAMelement. The other parts of the search expression 31 are compared in thesame way to the CAM words of the corresponding CAM elements. Each matchgenerates an association value 35, which is used as input in the lastCAM element. In the last CAM element in the parallel scheme theassociation values 35 of all the previous CAM elements 33 are combinedinto a set of selection fields 36, and this set is tested together withthe remaining word field (if any).

[0041] It is to be understood that the parallel and serial schemesdescribed above can be combined into more complex schemes. For examplein a serial structure, each CAM element can be substituted by a parallelstructure of CAM elements and vice versa. In this way structures ofarbitrary complexity can be built.

[0042] One way of forming schemes is to provide the CAM elements with acontrol bit. The control bit can be used to indicate whether or not theCAM words of the CAM element are provided with selection fields, or inother words if the element follows the serial scheme or the parallelscheme. The control bit may for instance be set to zero if the CAMelement does not have selection fields and to one if the CAM element hasselection fields. Schemes that are simple combinations of the paralleland the serial schemes can be formed by means of using a single controlbit. More than one control bit may be required to form more complexschemes.

[0043] In general the serial scheme requires less CAM entries thanparallel, while the parallel scheme favors search time, especially ifparallel branches are assigned to different physical CAMs.

[0044] The schemes above work as described if there are only singlematches in the CAM elements, i e when the bits of the search word andCAM words can have only defined values 0 or 1. When ternary CAMs areused, the CAM words can contain bit-values of 0, 1 and X, which makesmultiple matches possible. X matches both 0 and 1 in the search word. Ifmultiple matches are possible, only the most prioritized match in theCAM is detected. This word might not be part of the complete matchingexpression, but a CAM word with lower priority is.

[0045] An example of this is shown in FIG. 3a. Assume that we have twoexpressions A: x0x000 and B: x01x10 with output values 00 and 01respectively as shown in FIG. 3a. Suppose further that the CAM elementsused have word fields that can contain maximum four bits each and have afalling priority order. In reality, the CAM elements can be, and arealmost always, wider than that, but four is used here for clarity. A andB are stored according to the invention such that the four first bits,CAM words a0 and b0, of the expressions are stored in the first CAMelement. These CAM words are given output values 00 and 01 respectively.The rest of the bits, CAM words a1 and b1, of the expressions A and Bare stored in the subsequent CAM element, where the selection fields ofthese CAM words are given the corresponding values 00 and 01respectively. The output values of the expressions A and B are assignedto the last CAM element.

[0046] If a search expression like 001010 is to be matched against thecontents of the CAM elements, FIG. 3b, the search expression is dividedso that the first four bits, search word, are compared to the CAM wordsof the first CAM element. As can be seen from the figure, the searchword matches both CAM words a0 and b0 because of the X values in bitsthree and four of a0 and b0. However, only a0 is checked and matchedsince it is higher up, prioritized. The match will produce an outputvalue 00, which is combined with the subsequent search word 10. Thiswill however not produce a match in the subsequent CAM element since0010 is not stored there. This is because the match in the first CAMelement was not a correct match.

[0047] The solution according to the invention is to convert the CAMwords in CAM elements that have an associated CAM in such a way, thatonly single matches are possible.

[0048] In FIG. 4 two CAM words, A and B, are represented as a “range” ofnumeric values representing CAM words for which they match. Observe thatthese ranges are not necessarily contiguous but represent the set ofsearch words that match a CAM word consisting of a number of bits, wherethe bits can have values 0, 1 and X.

[0049] In order to achieve only single matches, A and B can be replacedwith three expressions:

[0050] 1. values that match both A and B,

[0051] 2. values that match only A,

[0052] 3. values that match only B.

[0053] According to the invention, an expression “share” is used, withwhich it is possible to construct the expression 1, i. e. that matchesboth A and B. The expression “share” will be defined and described indetail below. There is however no easy way to express the cases 2 and 3.

[0054] This is solved by using the fact that the CAM prioritizes matchesas described above, for example according to the order the expressionsare stored, see FIG. 5.

[0055]FIG. 5 illustrates that the three ranges in FIG. 4 can berepresented by the expressions “A∩B” (A and B) and the originalexpressions provided that A∩B is prioritized thereby “shadowing” theunwanted ranges of A and B.

[0056] The share of two words can be calculated using the bit-wiseoperator defined in Table 1 below. If one or more bits in the result ofthis operator contain Ø, there is no share. TABLE 1 A B 0 1 X 0 0 Ø 0 1Ø 1 1 X 0 1 X

[0057] Suppose that two wide expressions A and B are stored in CAMelements. A and B have been divided into parts a₀, a₁, . . . and b₀, b₁,. . . that are added to different CAM elements as described above inconnection to FIG. 3a.

[0058] If a₀∩b₀ ≠Ø, as shown in FIG. 3a and b, it is necessary to add ashare in the first CAM element. The share is created by using the bitoperator, and in the example shown in FIGS. 3a-c the share obtains thevalue X010. In order to prioritise the share it is placed above the CAMwords. This share must further be assigned an association value thatmatches the selection fields of both a₁ and b₁ in order to perform theshare operation.

[0059] One way to achieve this effect is to create copies of a₁ and b₁(a₁′ and b₁′ respectively) and assign selection fields matching theassociation value of a₀∩b₀, FIG. 3c. In the case shown, the associationvalue of the share is set to 11, as so are the selection fields of thecopies.

[0060] Another way to achieve the effect is to use X values in theselection fields of a₁ and b₁, FIG. 3d, and/or X in association value ofa₀∩b₀, FIG. 3e, such that a₁ and b₁ need not to be copied.

[0061] The concept of shares can be extended for any number of CAMwords. The share of X CAM words is then defined as the set of patterns,for which all these CAM words match.

[0062] Suppose that three entries A, B and C are added to a CAM elementand that their numerical ranges intersect as shown in FIG. 6.

[0063] To achieve only single matches, it is not enough to add the shareof A, B and C (A∩B∩C), because this only covers the case when all threeCAM words match. To cover the cases when only A and B, A and C or B andC match, we should add A∩B, A∩C and B∩C as well, as shown in FIG. 7. Ingeneral, all shares of any number and combination of CAM words should beadded such that all combinations of multiple matches are covered.

[0064] In this example, CAM words B and A∩C are completely shadowed byCAM words that are prioritised because CAM words higher up in the CAMare prioritised such that the share is prioritised. B and A∩C cantherefore never return their value and can be omitted.

[0065] The checking whether CAM words intersect may be performed eithereach time a new CAM word is to be stored or after a set of CAM words arestored.

[0066] In some instances the resulting share of two intersecting CAMwords is the same as one of the CAM words. As an example, a CAM word10XX to be stored is checked against the CAM words contained in the CAMelement. Suppose that one of the CAM words is 1XXX. According to theinvention, since they intersect, a share is required because of thesecond bits. However, the resulting share 10XX is the same as the CAMword to be stored, i e if the CAM word would be entered, it wouldcompletely shadowed by the share because of the priority. Therefore, theshadowed CAM word need not be entered and the share obtains theassociation value that the CAM word was to receive. It might also bethat the share is the same as a stored CAM word. Because of theprioritisation, the share completely shadows, and the shadowed CAM wordmay be removed, and possibly also the CAM words that it is associatedto.

[0067] For some applications it is possible to reduce the number ofshares required by reducing the number of entries, CAM words, if knownrestrictions and relationships within data sets can be exploited. Forexample for IP addresses in many applications, it is only meaningful tohave X's in consecutive positions at the end of the word. If this datafield is assigned to be the only field in a CAM element, each share willshadow one of its entries, resulting in no extra entries.

[0068] The number of entries added as a result of adding shares can bereduced if a suitable scheme of using X values in selection fields isemployed. Additionally association values can contain X values by usingglobal input masks. A scheme employing this can also be envisioned toreduce the number of entries.

[0069] The present invention may be implemented in any device intendedand used for computing digital information using CAMs, such as forexample routers, general purpose computers, and the like. The inventionis preferably implemented in the software of the device for performingthe storing and matching in the CAM elements. As mentioned before, theinvention is applicable to both several smaller CAMs where each CAM is aCAM element, or that one large CAM is divided into several CAM elements,or combination of these. FIG. 8 shows a schematic example of a router 10in which the present invention may be utilised. In the router theaddresses of the incoming packets at the incoming link 12 are checked inthe routing table 14 with the table look up function 16, comprising theCAMs and the means for dividing the address information into parts,means for matching the parts in CAM elements, and means for combiningthe matches in the CAM elements are located. Depending on the result ofthe match, the packets are then sent to the IP classification function18 that will decide whether to discard the IP packet, to send it tosoftware for further processing or to send the packet to the outgoinglink 20 via a switching device 22.

[0070] The output value of the match in the CAM can in this context beused to obtain information from another memory means containinginformation and data regarding addresses to send the packets to orinstructions on how to treat or process the packet. In some applicationsthe IP classification function is positioned before the table look upfunction. There may also be several other functions and featurescomprised in the router for handling packets. Since these do not formpart of the invention, they will not be described in detail.

[0071] The handling of the CAMs according to the present invention ispreferably implemented in the software of the computing device in theform of computer program code means or software code portions, althoughit is of course possible to implement the invention in the hardware ofthe computing device. The software may be stored in suitable memorymeans such as ROM, EPROM, RAM, SDRAM, optical or magnetic discs as wellas in a distributed fashion.

[0072] It is to be understood that the embodiments described above andshown in the drawings are to be regarded as non-limiting examples of thepresent invention and that the scope of protection is defined by thepatent claims.

1. Method for storing expressions of arbitrary width in content addressable memories (CAMs), wherein the method comprises the steps of dividing the expression into a number of consecutive parts, hereafter named CAM words, storing each word in a respective CAM element, wherein said CAM elements are a number of physical CAMs and/or designated parts of one physical CAM, associating each CAM word with the other CAM words of the expression where all the associated CAM words express the stored expression and, if a CAM word intersects with one or more of the CAM words of a CAM element, creating a word, hereafter named share, consisting of the union of the intersecting CAM words, assigning an association value to the share, and setting said association value to match the association values of the intersecting words.
 2. Method according to claim 1, wherein it comprises the steps of assigning an association value to each CAM word, and assigning a selection value to each associated CAM word, wherein the selection value matches the association value.
 3. Method according to claim 1 or 2, wherein associating each CAM word with its consecutive CAM word.
 4. Method according to claim 1 or 3, wherein associating each CAM word with the last CAM word of the expression.
 5. Method according to claim 1 or 2, wherein associating at least one first CAM word with its consecutive CAM word and wherein associating at least one second CAM word with a third CAM word, which third CAM word is a CAM word other than the consecutive CAM word of the second CAM word.
 6. Method according to any of claims 1-5, wherein each CAM element has a width that is less than the width of the expression.
 7. Method according to claim 1, wherein it comprises the steps of copying the words associated with the matching words, and assigning selection fields to the copied words, which selection fields match the association value of the share.
 8. Method according to any of the preceding claims, comprising the further step of assigning the share a higher priority than the intersecting words.
 9. Method for matching search expressions of arbitrary width with expressions stored in CAMs according to any of claims 1-8, wherein the method comprises the steps of dividing the search expression into consecutive parts hereafter named search words, comparing each of said search word to the CAM words of a respective CAM element of a number of CAM elements in order to obtain a match between the search word and a CAM word, associating said matches with each other, the associated matches corresponding to the said expression, and obtaining an output value from the match.
 10. Method according to claim 9, when dependent on claim 3, wherein a match between a search word and a CAM word provides an association value, which association value is used together with the consecutive search word for matching the consecutive search word with the CAM words of its CAM element.
 11. Method according to claim 9, when dependent on claim 4, wherein a match between a search word and the CAM words of its CAM element for all search words of the expression provide association values to the last search word of the expression.
 12. Method according to claim 9, when dependent on claim 5, wherein a match between at least one first search word and a CAM word provides a first association value, which first association value is used together with the consecutive search word for matching the consecutive search word with the CAM words of its CAM element, and wherein a match between at least one second search word and a CAM word provides a second association value, which second association value is used together with at least one other association value for matching one of the search words of the expression.
 13. Device for storing expressions of arbitrary width in content addressable memories (CAMs), comprising means for dividing the expression into a number of consecutive parts, hereafter named CAM words, means for storing each word in a respective CAM element, wherein said CAM elements are a number of physical CAMs and/or designated parts of one physical CAM, means for associating each CAM word with the other CAM words of the expression where all the associated CAM words express the stored expression and means for creating a word, hereafter named share, consisting of the union of the intersecting CAM words, assigning an association value to the share, and setting said association value to match the association values of the intersecting words, if a CAM word intersects with one or more of the CAM words of a CAM element.
 14. Device according to claim 13, wherein it comprises means for assigning an association value to each CAM word, and assigning a selection value to each associated CAM word, wherein the selection value matches the association value.
 15. Device for matching search expressions of arbitrary width with expressions stored in (CAMs) according to any of claims 13-14, comprising means for dividing the search expression into consecutive parts hereafter named search words, means for comparing each of said search word to the CAM words of a respective CAM element of a number of CAM elements in order to obtain a match between the search word and a CAM word, means for associating said matches with each other, the associated matches corresponding to the said expression, and means for obtaining an output value from the match.
 16. Computing apparatus comprising the device according to any of the claims 13-15.
 17. Computing apparatus according to claim 16, wherein it is a router.
 18. Computer program product comprising computer code means and/or software code portions for making a computer or processor perform the steps of any of the claims 1-12. 